package com.xnyzc.lhy.common.penum.user;

/**
 * @Description 用户性别 1：男，2：女，3：保密,4:未设置
 * @Author zhuyubin
 * @Date 2019-08-28 17:38
 **/
public enum EOaCUserSex {

    man("1", "男"),
    woman("2", "女"),
    secret("3", "保密"),
    unSetting("4", "未设置");

    private String value;
    private String desc;

    EOaCUserSex(String value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    /**
     * 查询性别
     * @param desc
     * @return
     */
    public static EOaCUserSex findByDesc(String desc) {
        EOaCUserSex eOaCUserSex;
        switch (desc) {
            case "男":
                eOaCUserSex = EOaCUserSex.man;
                break;
            case "女":
                eOaCUserSex = EOaCUserSex.woman;
                break;
            case "保密":
                eOaCUserSex = EOaCUserSex.secret;
                break;
            case "未设置":
                eOaCUserSex = EOaCUserSex.unSetting;
                break;
            default:
                throw new IllegalArgumentException("非法性别");
        }
        return eOaCUserSex;
    }

    public String getValue() {
        return value;
    }

    public String getDesc() {
        return desc;
    }
}
